//
//  FeedbackViewController.m
//  YunGou
//
//  Created by macbook on 16/5/18.
//  Copyright © 2016年 macbook. All rights reserved.
//

#import "FeedbackViewController.h"
#import "CustomTextView.h"
#import <Masonry.h>

@interface FeedbackViewController ()
@property (weak, nonatomic) IBOutlet UIView *feedbackBackView;
@property (weak, nonatomic) IBOutlet CustomTextView *feedbackText;
@end

@implementation FeedbackViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _feedbackBackView.layer.borderWidth = 1.0f;
    _feedbackBackView.layer.borderColor = ThemeColor.CGColor;
    _feedbackText.placeholder = @"请输入您对我们的建议和要求，促进我们更好的为您服务......";
}

- (IBAction)submitClicked:(id)sender {
    if (_feedbackText.text.length == 0) {
        [MBProgressHUD showError:@"内容不能为空"];
    }else{
        [NetWorkTool feedBackWithContent:_feedbackText.text success:^(id object) {
            if ([object[@"code"] integerValue] == 1) {
                [MBProgressHUD showSuccess:@"反馈成功"];
                _feedbackText.text = @"";
                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                    [self.navigationController popViewControllerAnimated:YES];
                });
            }
        } failure:^(NSError *error) {
            
        }];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
